﻿@model LabManagement.Data.Lab

@{
    ViewBag.Title = "Edit Lab";
    ViewBag.PageHeader = "Edit "+Model.LabName;
}
<div class="box box-bordered">
    <div class="box-title">
        <h3>
            <i class="fa fa-th-list"></i>@ViewBag.PageHeader
        </h3>
    </div>
    <div class="box-content nopadding">

        @using (Html.BeginForm("Edit", "Labs", FormMethod.Post, new { @class = "form-horizontal form-bordered" }))
        {
            @Html.AntiForgeryToken()
            @Html.ValidationSummary(true)

            @Html.HiddenFor(model => model.LabId)
            <div class="form-group">
                @Html.LabelFor(model => model.LabName, new { @class = "control-label col-sm-2" })
                <div class="col-sm-10">
                    @Html.TextBoxFor(model => model.LabName, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.LabName)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.LabDescription, new { @class = "control-label col-sm-2" })
                <div class="col-sm-10">
                    @Html.TextAreaFor(model => model.LabDescription, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.LabDescription)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.LabShortDescription, new { @class = "control-label col-sm-2" })
                <div class="col-sm-10">
                    @Html.TextAreaFor(model => model.LabShortDescription, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.LabShortDescription)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.LabTimeLimitInMinutes, new { @class = "control-label col-sm-2" })
                <div class="col-sm-10">
                    @Html.TextBoxFor(model => model.LabTimeLimitInMinutes, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.LabTimeLimitInMinutes)
                </div>
            </div>
            <div class="form-group">
                @Html.LabelFor(model => model.Active, new { @class = "control-label col-sm-2" })
                <div class="col-sm-10">
                    @Html.CheckBoxFor(model => model.Active)
                    @Html.ValidationMessageFor(model => model.Active)
                </div>
            </div>
            <div class="form-group">
                @Html.Label("Categories", new { @class = "control-label col-sm-2" })
                <div class="col-sm-10 container">
                    @{int i = 0;}
                    @foreach (var item in ViewBag.LabCategories)
                    {   <div>

                        @Html.CheckBox("LabCategories[" + i + "].Active", (bool)item.Active, new { @class = "col_sm_1" })
                        @Html.Hidden("LabCategories[" + i + "].CategoryId", (object)item.CategoryId)
                        @Html.Hidden("LabCategories[" + i + "].LabCategoryId", (object)item.LabCategoryId)
                        @Html.Hidden("LabCategories[" + i + "].LabId", (object)item.LabId)
                        @Html.Label((string)item.CategoryName, new { @class = "col_sm_4" })
                    </div>

                        i++;
                    }
                </div>
            </div>
            <div class="form-actions">
                <button type="submit" class="btn btn-primary">Save </button>
                @Html.ActionLink("Cancel", "Index", null, new { @class = "btn" })
            </div>

        }
    </div>